#ifndef GLOW_DEVICE_H
#define GLOW_DEVICE_H

#include <GL/glew.h>
#include <GL/glfw.h>
#include <string>
#include "Export.h"
#include "EventManager.h"
#include "ResourceManager.h"
#include "Renderer.h"
#include "Vector2.h"

namespace glow
{
	class SHARED GlowDevice
	{
		public :

		/**
		 * Builds a GLFW window with width*height ,
		 * fullScreen must be true for enble the full screen mode.
		 */
		bool init(int width = 600, int height = 800, bool fullScreen = false);

		/**
		 * Set the window's title.
		 */
		void setWindowTitle(std::string title);

		/**
		 * Set the window's size.
		 */
		void setWindowSize(int width, int height);

		/**
		 * Move the window to (x,y) position.
		 */
		void setWindowPos(int x, int y);

		/**
		 * Get the window's size
		 */
		const Vector2i&getSize() const;

		/**
		 * Show / Hide mouse cursor
		 */
		void showCursor(bool show);

		/**
		 * \return Renderer's singleton instance
		 */
		Renderer *getRenderer() const;

		/**
		 * \return EventManager's singleton instance
		 */
		EventManager *getEventManager() const;

		/**
		 * \return ResourceManager's singleton instance
		 */
		ResourceManager *getResourceManager() const;

		/**
		 * \return The GlowDevice's singleton instance
		 */
		static GlowDevice *getInstance();
		
		/**
		 * Destroy the singleton instance of the GlowDevice
		 */
		static void destroy();

		/**
		 * Return the Frame Per Seconde (FPS) value 
		 **/
		double getFPS();

		private :

		GlowDevice();
		~GlowDevice();

		Vector2i _size;
		bool _fullScreen;

		static GlowDevice *_inst;

		int _n;
		double _fps, _current_time, _start_time;

	};
}

#endif
